package collection_;

import java.util.*;

/**
 * @author 15594
 */
public class CollectionTest {
    public static void main(String[] args) {
        Collection collection = new ArrayList();
        collection.add("aa");
        collection.add(123);
        collection.add(new Object());
        collection.add(new String("lihua"));



        Collection collection1 = new ArrayList();
        collection1.add("aa");


        Collection collection2 = new ArrayList();
        collection2.add("aa");

        System.out.println("判断集合中是否包含指定元素"+collection.contains("aa"));
        System.out.println("判断两个集合是否相同"+collection1.containsAll(collection2));
        Iterator iterator = collection.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
            System.out.println(next);
        }

        System.out.println(collection.hashCode());
        Object[] objects = collection.toArray();
        Arrays.asList(objects);
        System.out.println(collection.toArray());

    }
}
